<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<script type="text/javascript" src="../../zxt/zxt.js"></script>
		<script>
			importZXT("../../zxt");
		</script>
	</head>

	<body>		
		<div>
			<a href="../index.html">返回</a>
		</div>
		<table>
			<tr>
				<td>getType()</td>
				<td>返回控件类型</td>
				<td><input type="button" name="getType" value="getType" 
					onclick="alert('控件的type为'+aMenu.getType());"/></td>
			</tr>
		</table>
		<div id="menu"></div>
	</body>

</html>

<script type="text/javascript">
	$(onLoaded)
	var aMenu

	function onLoaded() {
		var xml = "<tree><tree label='1' text='中国'><tree label='11' text='江苏'><tree label='111' text='南京'/><tree label='112' text='扬州' ><tree label='1121' text='江都' leaf='0'><tree label='11211' text='丁沟'><tree label='112111' text='丁西'/></tree></tree></tree></tree><tree label='12' text='上海'></tree></tree><tree label='2' text='美国'><tree label='21' text='纽约' leaf='1'/></tree></tree>"
		var bModel = new zxt.data.XmlTreeModel(xml);

		aMenu = new zxt.ui.Menu(bModel, "TESTTREE", "测试树");
		aMenu.textClicked = menuClicked;
		aMenu._horizental = false;
		aMenu._userHover = true;

		aMenu.depth(10);
		aMenu.hoverExpand = function(n) {
			if(n.depth() == 1)
				return false;
			else
				return true;
		}
		$("#menu").append(aMenu.render());
	}

	function menuClicked(node) {
		if(node.depth() > 1) {
			alert(node.label);
		}
	}

</script>